<?php get_header(); ?>
	<div id="floatswrap" class="clearfix noprint">
		<div id="featured_holder">
			<div class="outer">
				<div class="inner">
					<img src="<?php bloginfo('wpurl'); ?>/wp-content/themes/<?php echo get_option('wps_child_theme'); ?>/images/archive.jpg" alt="" />
				</div><!--inner -->
			</div><!--outer -->
		</div><!-- featured_holder -->
			
		<?php include(TEMPLATEPATH.'/top_sidebar.php');  ?>				
						
		<div id="breadcrumb" class="noprint">
			<?php if(class_exists('bcn_breadcrumb_trail'))
				{
					//Make new breadcrumb object
					$breadcrumb_trail = new bcn_breadcrumb_trail;
					//Setup options here if needed
					$breadcrumb_trail->opt['home_title'] = "Home";
					//Fill the breadcrumb trail
					$breadcrumb_trail->fill();
					//Display the trail
					$breadcrumb_trail->display();
				}
			?>
		</div><!-- breadcrumb -->				
		<div id="main_col" class="clearfix">
			<?php if (have_posts()) : ?>
				<h2 class="title">Showing all available items by <?php single_tag_title(); ?></h2>
				<?php 	$counter = 2;
		
					while (have_posts()) : the_post(); 
						
						$the_div_class = alternating_css_class($counter,2,' col_first');
								
				?>
					<div class="col<?=$the_div_class ?>">
						<div class="col_wrap post">
							<div class="col_wrap_inner clearfix">
								<a class="thumb_img" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
									<img src="<?php bloginfo('wpurl'); ?>/wp-content/themes/<?php echo get_option('wps_child_theme'); ?>/images/<?php get_custom_field('image_thumb', TRUE); ?>" width="89" height="112" alt="<?php the_title(); ?>" />
								</a>
								<div class="content">
									<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
									
									<?php if(get_post_meta($post->ID, 'new_price', true)) { 
										$values = get_post_custom_values("new_price"); 
										$new_price = $values[0]; ?>
														
										<span class="prices">				
											<span class="old_price"><?php get_custom_field('price', TRUE); ?></span><br/>
											<span class="new_price"><?php get_custom_field('new_price', TRUE); ?> <span class="currency"><?php echo get_option('wps_currency_code'); ?></span></span>
										</span>
													
									<?php } elseif(get_post_meta($post->ID, 'price', true)){ 
										$values 		= get_post_custom_values("price"); 
										$price 	= $values[0];?>
															
										<span class="price"><?php get_custom_field('price', TRUE); ?> <span class="currency"><?php echo get_option('wps_currency_code'); ?></span></span>
									<?php }	?>

									<form name="_xclick" action="" method="post">
										<input type="hidden" name="cmd" value="add" />									
										<input type="hidden" name="item_name" value="<?php the_title(); ?>" />									
										<input type="hidden" name="item_id" value="<?php get_custom_field('ID_item', TRUE); ?>"/>
										<input type="hidden" name="item_number" value="1"/>									
										<?php 
											if(get_post_meta($post->ID, 'new_price', true)) { 
												$values = get_post_custom_values("new_price"); 
												$new_price = $values[0]; ?>
											<input type="hidden" name="amount" value="<?php get_custom_field('new_price', TRUE); ?>" />
										<?php } 
											elseif(get_post_meta($post->ID, 'price', true)){ 
												$values 		= get_post_custom_values("price"); 
												$price 	= $values[0];?>
											<input type="hidden" name="amount" value="<?php get_custom_field('price', TRUE); ?>" />
										<?php }	?>									
										<input type="hidden" name="currency_code" value="<?php echo get_option('wps_currency_code'); ?>" />
										<input type="hidden" name="image_thumb" value="<?php get_custom_field('image_thumb', TRUE); ?>" />
										<input type="hidden" name="item_file" value="<?php get_custom_field('item_file', TRUE); ?>" />									
										<input type="hidden" name="add" value="1" />
										<div class="shopform_btn">
											<input type="image" name="add" src="<?php bloginfo('wpurl'); ?>/wp-content/themes/<?php echo get_option('wps_child_theme'); ?>/images/add_to_cart.png" />								
										</div>
									</form>	
								</div><!-- content -->
							</div><!-- col_wrap_inner -->
						</div><!-- col_wrap -->
					</div><!-- col -->

				<?php 
		
					$counter++;
				
				endwhile; ?>

				<?php
					include('wp-pagenavi.php');
					if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
				?>

			<?php else : ?>

				<h2>Not Found</h2>
				<?php include (TEMPLATEPATH . '/searchform.php'); ?>

			<?php endif; ?>
			
		</div><!-- main_col -->
		
		<?php get_sidebar(); ?>
	</div><!-- end floatswrap --> 
<?php get_footer(); ?>